var express = require('express');
var router = express.Router();
var Mock = require('mockjs');



/* GET home page. */
router.get('/', function(req, res, next) {
    let date= ["2021-06-05", "2021-06-06", "2021-06-07", "2021-06-08", "2021-06-09", "2021-06-10", "2021-06-11", "2021-06-12", "2021-06-13", "2021-06-14", "2021-06-15", "2021-06-16", "2021-06-17", "2021-06-18", "2021-06-19", "2021-06-20", "2021-06-21", "2021-06-22", "2021-06-23", "2021-06-24", "2021-06-25", "2021-06-26", "2021-06-27", "2021-06-28", "2021-06-29", "2021-06-30", "2021-07-01", "2021-07-02", "2021-07-03", "2021-07-04", "2021-07-05", "2021-07-06", "2021-07-07", "2021-07-08", "2021-07-09", "2021-07-10", "2021-07-11", "2021-07-12", "2021-07-13", "2021-07-14", "2021-07-15", "2021-07-16", "2021-07-17", "2021-07-18", "2021-07-19", "2021-07-20", "2021-07-21", "2021-07-22", "2021-07-23", "2021-07-24"];

    let userData=Mock.mock({
        "list|20":[{
            "name":"@cname",
            "posi|1":['内科诊室','外科诊室','脑科诊室','皮肤科诊室','传染病诊室'],
            'condition|1':['治疗中','等待中','治疗中','治疗中']
        }],
        "rank|20":[{
            "data|100-300":1,
        }],
        "value|50":[{
            "number|60-400":1,
        }],
        "header|10":[{
            "number|60-120":1,
        }]
    });
    let data={};
    let rank=[];
    let value=[];
    let header=[];
    for(let i=0;i<userData.rank.length;i++){
        rank[i]=userData.rank[i].data;
    };
    for(let i=0;i<userData.value.length;i++){
        value[i]=userData.value[i].number;
    };
    for (let i=0;i<10;i++){
        header[i]=userData.header[i].number;
    }
    data["peo"]=userData.list;
    data["rank"]=rank;
    data["date"]=date;
    data["value"]=value;
    data["header"]=header;
    // res.json();
    res.json(data);
});

module.exports = router;
